Repository navigation
feat(schema): column names on ClickHouse and a casing table option - #109
Merged
Merged
Conversation
CH.column takes name, as PG.column does: DDL, keys, statements and the tenant scope write the database name, and rows decode under the key. A casing option (snake_case or camelCase, drizzle-orm's rule) names every column that gives no name, on both dialects and on external tables. A materialized view whose target renames a column records a problem. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 46 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
Resolve the pg-define import conflict. main's SQLite table passed a typeOf callback to externalTable, which this branch removed; SQLite tables now name columns through namedColumnType and take the casing option (managed and external). ClickHouse tables check that no two keys map to one database name, as the Postgres and SQLite ones already do. Coverage: SQLite DDL, node:sqlite round trip and collisions under casing, and SQLite migration generation with cased and renamed columns. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
|
Merge-readiness pass (merge commit a6167e2, no rebase):
Verification (local, ClickHouse 26.8):
CI run 41473310518: the ClickHouse 26.2 job passed. The 26.8 job failed only on |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A ClickHouse column cannot have a database name apart from its key, and no table can derive its column names from a casing rule. Postgres had
PG.column(type, { name })only.Closes #87.
Part of #52.
Changes
CH.column(type, { name: "org_id" }), asPG.columnhas. The DDL (columns,ORDER BY,PRIMARY KEY,PARTITION BY, indexes, defaults), queries, inserts,ALTER TABLE ... UPDATE, lightweight deletes and the tenant scope write the database name. Rows decode under the key.casingtable option,"snake_case"or"camelCase"(newCasingtype on both entries), onCH.tableandPG.table, managed and external. It names every column that gives noname. A column's ownnamewins.orgIdandOrgId→org_id,HTTPStatus→http_status,address2stays). So a schema drizzle-kit made withcasing: "snake_case"keeps its names.sqlName. The builder sees only names, so decoding still reads the exact alias it wrote (the note indesign/gap-review.mdP2).docs/tables-and-types.md(backed by a docs example test),docs/reference.md, and the gap review. Oneminorchangeset.Left out
@@map: the first argument oftableis already the database name, and the variable is the TypeScript name. No table name is a key anywhere in the API. The docs now say so.tablein its own function.effect-orm pullstill writes the database names as keys. A--casingflag for pull can come later.Validation
bun run build: pass.bun run typecheck: pass.EFFECT_ORM_CLICKHOUSE_URL=http://127.0.0.1:8123 EFFECT_ORM_CLICKHOUSE_USER=maple EFFECT_ORM_CLICKHOUSE_PASSWORD=maple bunx vitest run --testTimeout=60000 --hookTimeout=60000: 62 files, 1047 tests passed, 0 skipped, on ClickHouse 26.8.2.7. The newtests/column-names.clickhouse.test.tscreates a cased table, a renamed column and a materialized view from their own DDL, and checkssystem.columns.node scripts/check-doc-citations.mjs,node scripts/check-exports-documented.mjs,node scripts/check-doc-examples.mjs: pass.bun scripts/check-package.ts: pass.Need help on this PR? Tag
@codesmith-botwith what you need.